package com.hotel.management.dto;

import com.fasterxml.jackson.annotation.JsonFormat;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 员工数据传输对象
 * 用于前端与后端之间的数据传输
 * 
 * @author Hotel Management Team
 * @version 1.0.0
 * @since 2024-06-28
 */
public class EmployeeDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 员工ID
     */
    private Long id;

    /**
     * 员工编号
     */
    @NotBlank(message = "员工编号不能为空")
    @Size(min = 3, max = 20, message = "员工编号长度必须在3-20个字符之间")
    private String employeeNo;

    /**
     * 员工姓名
     */
    @NotBlank(message = "员工姓名不能为空")
    @Size(min = 2, max = 50, message = "员工姓名长度必须在2-50个字符之间")
    private String name;

    /**
     * 性别 (男/女)
     */
    @NotBlank(message = "性别不能为空")
    @Pattern(regexp = "^(男|女)$", message = "性别只能是'男'或'女'")
    private String gender;

    /**
     * 年龄
     */
    @NotNull(message = "年龄不能为空")
    @Min(value = 18, message = "年龄不能小于18岁")
    @Max(value = 65, message = "年龄不能大于65岁")
    private Integer age;

    /**
     * 手机号码
     */
    @NotBlank(message = "手机号码不能为空")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号码格式不正确")
    private String phone;

    /**
     * 邮箱地址
     */
    @NotBlank(message = "邮箱地址不能为空")
    @Email(message = "邮箱地址格式不正确")
    @Size(max = 100, message = "邮箱地址长度不能超过100个字符")
    private String email;

    /**
     * 入职日期
     */
    @NotNull(message = "入职日期不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date hireDate;

    /**
     * 职位
     */
    @NotBlank(message = "职位不能为空")
    @Size(min = 2, max = 30, message = "职位名称长度必须在2-30个字符之间")
    private String position;

    /**
     * 角色ID (关联角色表)
     */
    @NotNull(message = "角色ID不能为空")
    private Long roleId;

    /**
     * 员工状态 (在职/离职/休假)
     */
    @NotBlank(message = "员工状态不能为空")
    @Pattern(regexp = "^(在职|离职|休假)$", message = "员工状态只能是'在职'、'离职'或'休假'")
    private String status;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    /**
     * 默认构造函数
     */
    public EmployeeDTO() {
    }

    /**
     * 带参数的构造函数
     */
    public EmployeeDTO(String employeeNo, String name, String gender, Integer age, String phone, String email,
                      Date hireDate, String position, Long roleId) {
        this.employeeNo = employeeNo;
        this.name = name;
        this.gender = gender;
        this.age = age;
        this.phone = phone;
        this.email = email;
        this.hireDate = hireDate;
        this.position = position;
        this.roleId = roleId;
        this.status = "在职"; // 默认状态
    }

    // Getter and Setter methods
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getEmployeeNo() {
        return employeeNo;
    }

    public void setEmployeeNo(String employeeNo) {
        this.employeeNo = employeeNo;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Date getHireDate() {
        return hireDate;
    }

    public void setHireDate(Date hireDate) {
        this.hireDate = hireDate;
    }

    public String getPosition() {
        return position;
    }

    public void setPosition(String position) {
        this.position = position;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }
}
